package org.example.demo_ottery.common.exception;

import lombok.Data;
import lombok.EqualsAndHashCode;
import org.example.demo_ottery.common.errorcode.ErrorCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class ServiceException extends RuntimeException {

    /**
     * 异常码
     * @see org.example.demo_ottery.common.errorcode.ServiceErrorCodeConstants
     */
    private Integer code;

    /**
     * 异常信息
     * @see org.example.demo_ottery.common.errorcode.ServiceErrorCodeConstants
     */
    private String massage;

    public ServiceException () {

    }

    public ServiceException (Integer code,String massage) {
        this.code = code;
        this.massage = massage;
    }

    public ServiceException (ErrorCode errorCode) {
        this.code = errorCode.getCode();
        this.massage = errorCode.getMassage();
    }
}
